home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 4 / FM Towns Free Software Collection 4 - Disc 1.iso / msdos / mcpr / cprbuf.asm next >
Assembly Source File  |  1991-10-18  |  4KB  |  212 lines

  1.     page    95,132
  2. ;§∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞§
  3. ;§                                                                          §
  4. ;§            マルチカラム コンパクト プリント ユーティリティ            §
  5. ;§                                                                          §
  6. ;§   Multicolumn Compact PRint utility   MCPR.EXE  Ver1.40    §
  7. ;§   ~           ~       ~~                                                 §
  8. ;§              Copyright (C) by 福地 邦雄 1989-1990. All rights reserved.  §
  9. ;§∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞§
  10.     public    namebuf
  11.     public    namebufoff
  12.     public    namebufseg
  13.     public    nameptr
  14.     public    nameptroff
  15.     public    nameptrseg
  16.     public    filebuf
  17.     public    filebufoff
  18.     public    filebufseg
  19.     public    bitimg
  20.     public    bitimgoff
  21.     public    bitimgseg
  22.     public    prtbuf
  23.     public    prtbufoff
  24.     public    prtbufseg
  25.     public    pgbuf
  26.     public    pgbufoff
  27.     public    pgbufseg
  28.     public    pgbufsiz
  29.     public    allocnambuf
  30.     public    freenambuf
  31.     public    allocprtbuf
  32.     public    freeprtbuf
  33.     extrn    linsiz:word
  34.     extrn    lincnt:word
  35.     extrn    hdrprint:word
  36.     extrn    hdrlinseg:word
  37.     extrn    hdrln2seg:word
  38.     extrn    pgwidth:word
  39.     extrn    pghight:word
  40.     extrn    clmpitch:word
  41.     extrn    errorno:word
  42.     extrn    abort:near
  43. ;
  44. YES    equ    1
  45. ;
  46. data    segment para    public    'DATA'
  47. ;
  48. namebuf label    dword
  49. namebufoff  dw    0
  50. namebufseg  dw    0
  51. ;
  52. nameptr label    dword
  53. nameptroff  dw    0
  54. nameptrseg  dw    0
  55. ;
  56. filebuf label    dword
  57. filebufoff  dw    0
  58. filebufseg  dw    0
  59. ;
  60. bitimg    label    dword
  61. bitimgoff   dw    0
  62. bitimgseg   dw    0
  63. ;
  64. prtbuf    label    dword
  65. prtbufoff   dw    0
  66. prtbufseg   dw    0
  67. ;
  68. pgbuf    label    dword
  69. pgbufoff    dw    0
  70. pgbufseg    dw    0
  71. ;
  72. pgbufsiz    dw    ?
  73. ;
  74. allocmsg    db    'memory allocation error',0dh,0ah
  75. alcmsgsiz   equ     $-allocmsg
  76. ;
  77. data    ends
  78. ;
  79. code    segment para    public    'CODE'
  80.     assume    cs:code,ds:data
  81. ;
  82. allocnambuf proc
  83. ;
  84.     mov    bx,4096/16         ;file name build buffer size
  85.     call    dosalloc
  86.     mov    namebufseg,ax
  87. ;
  88.     mov    bx,1024/16        ;file name list pointer buffer size
  89.     call    dosalloc
  90.     mov    nameptrseg,ax
  91.     ret
  92. ;
  93. allocnambuf endp
  94. ;
  95. freenambuf  proc
  96. ;
  97.     mov    ah,49h
  98.     mov    es,namebufseg
  99.     int    21h
  100. ;
  101.     mov    ah,49h
  102.     mov    es,nameptrseg
  103.     int    21h
  104.     ret
  105. ;
  106. freenambuf  endp
  107. ;
  108. allocprtbuf    proc
  109. ;
  110.     mov    bx,8192/16        ;file read buffer size
  111.     call    dosalloc
  112.     mov    filebufseg,ax
  113. ;
  114.     cmp    clmpitch,3
  115.     jne    nobitaloc
  116. ;
  117.     mov    ax,32            ;buffer size for 1 column
  118.     mul    linsiz
  119.     and    dx,0fh
  120.     or    ax,dx
  121.     mov    cl,4
  122.     ror    ax,cl
  123.     mov    bx,ax
  124.     call    dosalloc        ;bit image buffer
  125.     mov    bitimgseg,ax
  126. ;
  127.     call    dosalloc        ;print data buffer
  128.     mov    prtbufseg,ax
  129. ;
  130. nobitaloc:
  131.     mov    ax,linsiz          ;calculate page buffer size
  132.     mul    lincnt
  133.     mov    bx,ax
  134.     shr    ax,1
  135.     mov    pgbufsiz,ax
  136.     cmp    hdrprint,YES
  137.     jne    nohdrsiz
  138.     add    bx,linsiz
  139.     add    bx,linsiz
  140. nohdrsiz:
  141.     mov    cl,4
  142.     shr    bx,cl
  143.     call    dosalloc
  144.     mov    pgbufseg,ax
  145. ;
  146.     cmp    hdrprint,YES
  147.     jne    nohdrstr
  148.     mov    dx,pgbufsiz
  149.     mov    cl,3
  150.     shr    dx,cl
  151.     add    ax,dx
  152.     mov    dx,ax
  153.     mov    hdrlinseg,ax
  154.     mov    bx,linsiz
  155.     mov    cl,4
  156.     shr    bx,cl
  157.     add    ax,bx
  158.     mov    hdrln2seg,ax
  159.     xor    ax,ax
  160.     mov    di,ax
  161.     mov    cx,linsiz
  162.     mov    es,dx
  163.     cld
  164.     rep stosw
  165. nohdrstr:
  166.     ret
  167. ;
  168. allocprtbuf endp
  169. ;
  170. freeprtbuf  proc
  171. ;
  172.     mov    ah,49h
  173.     mov    es,filebufseg
  174.     int    21h
  175. ;
  176.     cmp    clmpitch,3
  177.     jne    nobitfree
  178. ;
  179.     mov    ah,49h
  180.     mov    es,bitimgseg
  181.     int    21h
  182. ;
  183.     mov    ah,49h
  184.     mov    es,prtbufseg
  185.     int    21h
  186. ;
  187. nobitfree:
  188.     mov    ah,49h
  189.     mov    es,pgbufseg
  190.     int    21h
  191. ;
  192.     ret
  193. ;
  194. freeprtbuf  endp
  195. ;
  196. dosalloc    proc
  197. ;
  198.     mov    ah,48h
  199.     int    21h
  200.     jc    allocerr
  201.     ret
  202. allocerr:
  203.     mov    errorno,ax
  204.     mov    dx,offset allocmsg
  205.     mov    cx,alcmsgsiz
  206.     jmp    abort
  207. ;
  208. dosalloc    endp
  209. ;
  210. code    ends
  211.     end
  212.